﻿namespace ShortcutReader.Helpers
{
    using System;
    using System.Runtime.InteropServices;
    using System.Text;

    public static class PathHelper
    {
        #region Methods

        public static String GetLongPathName(String shortPath)
        {
            StringBuilder longPath = new StringBuilder(1024);

            if (0 == GetLongPathName(shortPath, longPath, longPath.Capacity))
            {
                return shortPath;
            }

            return longPath.ToString();
        }

        [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
        private static extern Int32 GetLongPathName(String shortPath, StringBuilder longPath, Int32 longPathLength);

        #endregion Methods
    }
}